enum FileFilterEnum {
  video(value: 1, title: "只选择视频", extensions: [".mkv", ".mp4", ".rm", ".rmvb"]),
  book(value: 2, title: "只选择书籍", extensions: [".pdf", ".epub"]),
  videoAndBook(
      value: 3,
      title: "书籍和视频",
      extensions: [".mkv", ".mp4", ".rm", ".rmvb", ".pdf", ".epub"]);

  final int value;
  final String title;
  final List<String> extensions;

  const FileFilterEnum(
      {required this.value, required this.title, required this.extensions});

  static FileFilterEnum fromInt(int value) {
    for (FileFilterEnum typeItem in FileFilterEnum.values) {
      if (typeItem.value == value) {
        return typeItem;
      }
    }
    return FileFilterEnum.videoAndBook;
  }

  @override
  String toString() {
    switch (value) {
      case 1:
        return "video";
      case 2:
        return "book";
      case 3:
        return "videoAndBook";
      default:
        return "book";
    }
  }
}
